package com.leyou.common.exception.pojo;

import lombok.Getter;

/**
 * 乐优公共自定义异常类
 */
@Getter
public class LyException extends RuntimeException {
    private Integer status;//状态码

    /**
     * Constructs a new runtime exception with the specified detail message.
     * The cause is not initialized, and may subsequently be initialized by a
     * call to {@link #initCause}.
     *
     * @param message the detail message. The detail message is saved for
     *                later retrieval by the {@link #getMessage()} method.
     */
    public LyException(String message, Integer status) {
        super(message);
        this.status = status;
    }

    /**
     * 自定义枚举状态码封装
     * @param e
     */
    public LyException(ExceptionEnum e) {
        super(e.getMessage());
        this.status = e.getStatus();
    }
}
